package com.mdd.service.impl;

import com.mdd.domain.Book;
import com.mdd.mapper.BookMapper;
import com.mdd.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookMapper bookMapper;

    public List<Book> selectAll() {
        return bookMapper.selectAll();
    }

    public Boolean addBook(Book book) {
        Integer num = bookMapper.addBook(book);
        return num>0;
    }

    public Book selectById(Integer id) {
        return bookMapper.selectById(id);
    }

    public Boolean updateById(Book book) {
        Integer num = bookMapper.updateById(book);
        return num >0;
    }

    public Boolean deleteById(Integer id) {
        Integer num = bookMapper.deleteById(id);
        return num > 0;
    }
}
